//
//  OAError.m
//  OARetail
//
//  Created by ChenJie on 5/15/20.
//  Copyright © 2020 Mist. All rights reserved.
//

#import "OAError.h"

@interface OAError ()

@end

@implementation OAError

#pragma mark - Lifecycle methods

- (instancetype)init {
    self = [super init];
    if (self) {
    }
    return self;
}

- (instancetype)initWithType:(OAErrorType)type
                        code:(NSInteger)code
                     message:(NSString *)message {
    
    self = [self init];
    if (self) {
        self.type = type;
        self.code = code;
        self.message = message;
    }
    return self;
}

- (instancetype)initWithRawError:(NSError *)rawError {
    self = [self init];
    if (self) {
        self.type = OAErrorTypeNetworkError;
        self.code = rawError.code;
        self.message = rawError.localizedDescription;
        self.rawError = rawError;
    }
    return self;
}

+ (instancetype)errorWithType:(OAErrorType)type
                         code:(NSInteger)code
                      message:(NSString *)message {
    
    return [[OAError alloc] initWithType:type code:code message:message];
}

+ (instancetype)errorWithRawError:(NSError *)rawError {
    return [[OAError alloc] initWithRawError:rawError];
}

#pragma mark - Public methods



#pragma mark - Private methods



#pragma mark - Delegate methods



#pragma mark - Setter



#pragma mark - Getter



#pragma mark - Memory management methods

- (void)dealloc {
}

@end
